package com.ruoyi.project.ins.utils;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

@Data
public class HttpResult {
    private int statusCode;  // 响应码
    private String body;     // 响应文本
    private Map<String, String> headers;

    public HttpResult(int statusCode, String body) {
        this.statusCode = statusCode;
        this.body = body;
    }

    public HttpResult(int statusCode, String body, Map<String, String> headers) {
        this.statusCode = statusCode;
        this.body = body;
        this.headers = headers;
    }

    public String getBody() {
        if (StringUtils.isEmpty(body)) {
            return StringUtils.EMPTY;
        }
        return body;
    }
}
